<?php
namespace app\index\controller;

use app\common\controller\Frontend;
use app\admin\library\Auth;

class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        parent::_initialize();
    }

    public function index()
    {

        $auth = new Auth();
   
        if($auth->isLogin()) {
            $url = url('admin/index/index');
        } else {
            $url = url('admin/index/login');
        }
        
       // 跳转到后台登陆页面        
        $this->redirect($url);
        
        //return $this->view->fetch();
    }

    public function news()
    {
        $newslist = [];
        return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'http://www.fastadmin.net?ref=news']);
    }

}
